package com.xing.fragment;

import com.xing.questionnairesurvey.R;
import com.xing.util.CurrentUserUtil;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class AboutFragment extends SuperFragment {
	private View view;
	private FragmentManager fragmentManager;
	private Button leftButton;
	private Button rightButton;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		fragmentManager = getFragmentManager();
		return (view = inflater.inflate(R.layout.about_fragment, container, false));
	}
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
		
		userNameTextView = (TextView) view.findViewById(R.id.user_name);
		userNameTextView.setText(CurrentUserUtil.userName+",欢迎使用!");
		leftButton = (Button) view.findViewById(R.id.left_btn);
		rightButton = (Button) view.findViewById(R.id.right_btn);
		
		leftButton.setOnClickListener(myListener);
		rightButton.setOnClickListener(myListener);
	}

	
private OnClickListener myListener = new View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			switch (v.getId()) {
			case R.id.left_btn:
				
				leftButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.table_left_bg_on));
				rightButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.table_right_bg_default));
				break;
			case R.id.right_btn:
				
				
				leftButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.table_left_bg_default));
				rightButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.table_right_bg_on));
				break;
			default:
				break;
			}
		}
	};
}
